#include<iostream>
#include<cstdio>
using namespace std;

int arr[100][100];

int main()
{
	int n, m;
	cin >> n >> m;
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> arr[i][j];
			
	for (int i = 0; i < n; i++)
	{
		int num = 0; 
		for (int j = 0; j < m; j++)
		{
			cin >> num;
			arr[i][j] += num;
		}
	}
	
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++) 
		{
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}	
		
	
	return 0;
}
